<%@ page language="java" import="web_package.ScalaCaller, db.User" contentType="text/html; charset=windows-1255" pageEncoding="windows-1255"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
<title>Insert title here</title>
</head>
<body>
	<%
		if(!request.getParameter("password").equals(request.getParameter("confirmPassword"))){
			%> Sorry, something is wrong with your password<br/>
				Please try again: <a href="signin.jsp">here</a>
			<%
		}else{
			%>
			<jsp:useBean id="user" class="db.User" scope="session"/>
			<jsp:setProperty property="*" name="user"/>
			<%
			user = ScalaCaller.signNewUser(user);
			if(user==null){
				session.removeAttribute("user");
				%> User already exists. Please login through <a href="home.jsp">here</a>.
				<%
			}
			response.sendRedirect("userHome.jsp");
		}
	%>
</body>
</html>